function nkGenie.ExtMask:new(name, parent, settings)

	local this = {}
	this.name = name
	this.parent = parent
	
	local element = UI.CreateFrame("Mask", name, parent)
		
	this.element = element
	setmetatable(this, self)
	self.__index = self
	return this
	
end

function nkGenie.ExtMask:update (settings)

	if settings == nil then return end
	
	if settings.template ~= nil then
		for k, v in pairs (settings.template) do if settings[k] == nil then settings[k] = v end end
		settings.template = nil
	end	
	
	if settings.width ~= nil then self.element:SetWidth(settings.width) end
	if settings.height ~= nil then self.element:SetHeight(settings.height) end
	
	if settings.anchors ~= nil then
		for k, anchor in pairs(settings.anchors) do
			if anchor.x ~= nil and anchor.y ~= nil then
				self.element:SetPoint (anchor.from, anchor.object, anchor.to, anchor.x, anchor.y)
			else
				self.element:SetPoint (anchor.from, anchor.object, anchor.to)
			end
		end
	end
				
	if settings.layer ~= nil then self.element:SetLayer(settings.layer) end
	if settings.strata ~= nil then self.element:SetStrata(settings.strata) end
	if settings.visible ~= nil then self.element:SetVisible(settings.visible) end
	
	for k, v in pairs (settings) do self[k] = v end
	
end

function nkGenie.ExtMask:getElement() return self.element end

function nkGenie.ExtMask:GetVisible() return self:getElement(false):GetVisible() end
function nkGenie.ExtMask:SetVisible(flag) self:getElement(false):SetVisible(flag) end
function nkGenie.ExtMask:SetParent(parent) self:getElement(false):SetParent(parent) end
function nkGenie.ExtMask:GetWidth() return self:getElement(false):GetWidth() end
function nkGenie.ExtMask:GetHeight() return self:getElement(false):GetHeight() end
function nkGenie.ExtMask:SetSecureMode(mode) self:getElement(false):SetSecureMode(mode) end
function nkGenie.ExtMask:SetStrata(strata) self:getElement(false):SetStrata(strata) end
function nkGenie.ExtMask:SetLayer(layer) self:getElement(false):SetLayer(layer) end